﻿using System;

namespace Microsoft.SPOT.Hardware
{
    public class Port : NativeEventDispatcher
    {
        protected Port(Cpu.Pin portId, bool initialState)
            : base("unknownDriverName", 4711)
        {
            Id = portId;
        }

        protected Port(Cpu.Pin portId, bool initialState, bool glitchFilter, Port.ResistorMode resistor)
            : this(portId, initialState)
        {
        }

        //protected Port(Cpu.Pin portId, bool glitchFilter, Port.ResistorMode resistor, Port.InterruptMode interruptMode);

        public Cpu.Pin Id { get; private set; }

        public bool StateInternal { get; set; }

        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);
        }

        public bool Read()
        {
            return StateInternal;
        }

        public static bool ReservePin(Cpu.Pin pin, bool fReserve)
        {
            return true;
        }

        public enum InterruptMode
        {
            InterruptNone = 0,
            InterruptEdgeLow = 1,
            InterruptEdgeHigh = 2,
            InterruptEdgeBoth = 3,
            InterruptEdgeLevelHigh = 4,
            InterruptEdgeLevelLow = 5,
        }

        public enum ResistorMode
        {
            Disabled = 0,
            PullDown = 1,
            PullUp = 2,
        }
    }
}
